<template>
  <div class="product">
    <h3>{{ pname }}</h3>
    <p>价格：{{ price }} 元一斤</p>
    <p>{{ info }}</p>
    <button @click="$emit('kanyidao', 1, id)"></button>
  </div>
</template>

<script>
export default {
  // 子组件使用 props 接收数据
  props: ["id", "pname", "price", "info"],
};
</script>

<style scoped>
.product {
  padding: 20px;
  margin: 10px;
  border: 3px solid #000;
  border-radius: 5px;
}
</style>
